UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kC9bpZh3+80p0DJmgQUyJgyz5iWIKminvj1tI1iKKJ4=' 
WHERE 
  key_id = 'f1766595a1eb74c7a5e65d17c8c9a9d4a00c6948500513888125cfc9125c79d5' 
  AND (
    token = 'kC9bpZh3+80p0DJmgQUyJgyz5iWIKminvj1tI1iKKJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031