UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z/63E0+ujIM0Kvob20ajlcQsw93NAizAftvzfUzrTBc=' 
WHERE 
  key_id = 'ccb57a08d9f7e049763adbbe95163855a0d61a9372a6ae0b8a9d3a57821787c7' 
  AND (
    token = 'z/63E0+ujIM0Kvob20ajlcQsw93NAizAftvzfUzrTBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022