UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y1TC+V8f87zc2eXwAOEGZ4eR+Ka0garCj5t4P1qdcfI=' 
WHERE 
  key_id = 'd32f3b1111e30167e7179b90e0b7444d2b6e1e00dfd801196317467d72a6a44b' 
  AND (
    token = 'Y1TC+V8f87zc2eXwAOEGZ4eR+Ka0garCj5t4P1qdcfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051