UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1YERwRgFRgg/xMaraiuWFunqtO4lRwLMYMJUaW/Y/Ik=' 
WHERE 
  key_id = '12c11a820ccb542aa7e58298576ce5e8a50b4d65272d91dd205c24d246cbee50' 
  AND (
    token = '1YERwRgFRgg/xMaraiuWFunqtO4lRwLMYMJUaW/Y/Ik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029