UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UHUl34/lwHZakgPEfewHPDthuj0bxlyd14QWP6HhLZw=' 
WHERE 
  key_id = 'e8df476c27b967ff99aa5246a97bb33bf2ae08c33b969b53bb5e9ea9fa3edb1c' 
  AND (
    token = 'UHUl34/lwHZakgPEfewHPDthuj0bxlyd14QWP6HhLZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054