UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DIjhrGHF0H1pFdS/iWIS3e8VvkFf3KqyL79tL6Nhtvo=' 
WHERE 
  key_id = 'a2f58158c7125fa9986e4dcc11494f3248d0ae06757ad3eae2f936186abae36e' 
  AND (
    token = 'DIjhrGHF0H1pFdS/iWIS3e8VvkFf3KqyL79tL6Nhtvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026