UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bfPwPRLC3KPDVQ8mttcQKBxP4IpwDLGVLqzqRW7wB+g=' 
WHERE 
  key_id = 'a71ff193f9386b61f4377e0d36a13cab336bf473583a894a7bb6d550fb8a58e2' 
  AND (
    token = 'bfPwPRLC3KPDVQ8mttcQKBxP4IpwDLGVLqzqRW7wB+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021