UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WIAkXsV1kMJv3SzbywqVf6ACezNMuJw66QE9h0CYoro=' 
WHERE 
  key_id = '5bae826d8d1ef5e326edfe4c61b7e748b7614733623f289156cb17f033b3f142' 
  AND (
    token = 'WIAkXsV1kMJv3SzbywqVf6ACezNMuJw66QE9h0CYoro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027