UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g5QXqrdH0E0QsbC0ygV1jKuubaRqkT+48eVNGKrfRNY=' 
WHERE 
  key_id = '12236e9ecced9b21e6249034b7521540a30fd4bc3580c855484f1a42defc34c8' 
  AND (
    token = 'g5QXqrdH0E0QsbC0ygV1jKuubaRqkT+48eVNGKrfRNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00131