UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XQkapzXPM9pTyUROsdpOtayL+MMlcCTI3E/oUT9OE2Q=' 
WHERE 
  key_id = '11ce41f8b52a8fc6264cfa0828599179e6ce64fe5f6dbe43fcdef30bb19b2a8a' 
  AND (
    token = 'XQkapzXPM9pTyUROsdpOtayL+MMlcCTI3E/oUT9OE2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032