UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JEm1Rfw5keIYbkFNGi0vKVuFEaqkbCbkQVyC0grIPNI=' 
WHERE 
  key_id = '8d73162d092134724ed203635144054362ac60cd6910c49373c36b559b3e30ec' 
  AND (
    token = 'JEm1Rfw5keIYbkFNGi0vKVuFEaqkbCbkQVyC0grIPNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034