UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ha5KyHeh982kTNWuE/Y2n0/tpEpi2RQG+ne5wy96vYY=' 
WHERE 
  key_id = '404294417afdf5acdb68faea895b56308ca5187b634c3c8378f97d6129119134' 
  AND (
    token = 'ha5KyHeh982kTNWuE/Y2n0/tpEpi2RQG+ne5wy96vYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026