UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm66CNu5+ud5niNQoWeSERf9W+UBPjEv1i+N3iyoHmhc=' 
WHERE 
  key_id = '62fd2e61c0d96e23cf40914348dc32cccd955294b9763d0c7bcd31da5cfe2f35' 
  AND (
    token = 'm66CNu5+ud5niNQoWeSERf9W+UBPjEv1i+N3iyoHmhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026