UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DuEcI5gfpAv6Xo8A4euxfszhuK0d34qR9zNLSJKQDbQ=' 
WHERE 
  key_id = '3b4a7793bb113bf989c5305369bdd7e4fc99b7c1a1ac754da35ea6ebe8ebf763' 
  AND (
    token = 'DuEcI5gfpAv6Xo8A4euxfszhuK0d34qR9zNLSJKQDbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046