UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMdIsqFKlhmUMOA5881oaQ/SpBmBqdGYgx27ewMVy5Q=' 
WHERE 
  key_id = 'f9c8717785c5ec4436aaeaea0f985991fa694e04f41bdb49c90758cc5cc6ebfb' 
  AND (
    token = 'KMdIsqFKlhmUMOA5881oaQ/SpBmBqdGYgx27ewMVy5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053