UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HjTZ70Zb0t19w0gp7aMcO+lW36hNXN31EauqtsLAy98=' 
WHERE 
  key_id = '46da4d8cc5f187fe062c7aadd80439363f8a45d04901422c7484668ce52e1c79' 
  AND (
    token = 'HjTZ70Zb0t19w0gp7aMcO+lW36hNXN31EauqtsLAy98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032