UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J7jThr/36cjg9yr/bFiJTKdgwkT0S/t+yMpXbo5Q1Ng=' 
WHERE 
  key_id = '4e5bbab971a061a118d21110ebb586cd025b0b0e9d4f1997f44cfaf3aab37fd6' 
  AND (
    token = 'J7jThr/36cjg9yr/bFiJTKdgwkT0S/t+yMpXbo5Q1Ng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037