UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'riEaqTHb/vPsQ4snYgxWy1TrPECXEM2yJzTYuJDwONE=' 
WHERE 
  key_id = '1002d2d1ad70f8858942209e168c3beeb1afdf14bb5d94cfd9cfe3c16d72f930' 
  AND (
    token = 'riEaqTHb/vPsQ4snYgxWy1TrPECXEM2yJzTYuJDwONE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029