UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z8HOBw9Mn5PIxS5biC2VEiOG+4Zi+t7wvxymuBsvoCY=' 
WHERE 
  key_id = 'c64e390cc47d97044194f8108f526f50918fef6b7a222cdf133666eb53ab8f2b' 
  AND (
    token = 'z8HOBw9Mn5PIxS5biC2VEiOG+4Zi+t7wvxymuBsvoCY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057