UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9T6jam8ej1khsu+RI248aOjFKLnn6NtWBvM80WedRw=' 
WHERE 
  key_id = '19fa590de1963d66667bab5f5e779c052034b8fc12ef8c365614d7d5a3d6b3e1' 
  AND (
    token = 'q9T6jam8ej1khsu+RI248aOjFKLnn6NtWBvM80WedRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033