UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mu69KkS2O/12feu9rnVqwa8pCb6PoVfUAvWFZ5aLfIk=' 
WHERE 
  key_id = '8b747147f675628f56a30d048c4d53facc57fe42f5610e2703df3ed3ccba890e' 
  AND (
    token = 'Mu69KkS2O/12feu9rnVqwa8pCb6PoVfUAvWFZ5aLfIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053