UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uSr19ElopJK7BAIkSf5taWK0NhBgdFMT9NkjXtqp1Fk=' 
WHERE 
  key_id = 'ae616fb8bee06694328e704337f613c435af97381895f49c9af7c04555aef885' 
  AND (
    token = 'uSr19ElopJK7BAIkSf5taWK0NhBgdFMT9NkjXtqp1Fk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031