UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5i7iKI0NX1PLOtcSTsyGPeCzJJmyfKZzNUMjdt9CJw=' 
WHERE 
  key_id = '382ec84f2cbf6b4f39dea748ed5888b0d87feabb452ee5485684e78a05bc3444' 
  AND (
    token = 'D5i7iKI0NX1PLOtcSTsyGPeCzJJmyfKZzNUMjdt9CJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017