UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MK7ikBnaeye3qLbMM2kDEEmivKqzr63YTWocCJfeEkI=' 
WHERE 
  key_id = '0f364c921ef2b40f6ba182cce99af99c5bb63d057d2c8304e6c18d936086110b' 
  AND (
    token = 'MK7ikBnaeye3qLbMM2kDEEmivKqzr63YTWocCJfeEkI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026