UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dgs6RejunWjcNLomAJVkYWxjZBVCY1FppuYqTC0Ascw=' 
WHERE 
  key_id = '57c474decca14a69ae7de1d3d5714519dfcab19186f0d8486576897f5accbe44' 
  AND (
    token = 'Dgs6RejunWjcNLomAJVkYWxjZBVCY1FppuYqTC0Ascw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046