UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8GHQ8G1Hr4bDMO/tVGJcZW15ZFCAwWi+P8M+Fx2T624=' 
WHERE 
  key_id = '6ef3e5b5a884bc43ec79d85582e78152191c2f89d14a55bb104330d917b6c356' 
  AND (
    token = '8GHQ8G1Hr4bDMO/tVGJcZW15ZFCAwWi+P8M+Fx2T624=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024