UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBpZbTYQh4Tf7nuvoLTX62UH1x8brUYJpNwersue38k=' 
WHERE 
  key_id = '182c68bf6bff728e7232e76d4a6867e77694508114344fef0fbf23502577d7a1' 
  AND (
    token = 'fBpZbTYQh4Tf7nuvoLTX62UH1x8brUYJpNwersue38k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020