UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YwqEALQjwM7iIKOnudU8hHunH5IueQph8yMgiNhjwyc=' 
WHERE 
  key_id = 'e9a6cc01eacf117307a4a2fde8a97af292c1ec2981ff2277ba3e277dce96ffef' 
  AND (
    token = 'YwqEALQjwM7iIKOnudU8hHunH5IueQph8yMgiNhjwyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030