UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MoeXRoIia4sthQI6sRI6PUDs0/WL7+e0hKj29v1+Ovk=' 
WHERE 
  key_id = 'd5ffade9964be97a0568878f2f907ef1ff90464103ef7728f76899e5badf25d7' 
  AND (
    token = 'MoeXRoIia4sthQI6sRI6PUDs0/WL7+e0hKj29v1+Ovk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036