UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MHyvkm7sciT+xU39Ym2mfOrMi/Xjq+eUh1CRMpc7BEg=' 
WHERE 
  key_id = 'a8a8e60dd92a0440b06baf04917143e1ccdf669551a45bb83f98e680d353c7a9' 
  AND (
    token = 'MHyvkm7sciT+xU39Ym2mfOrMi/Xjq+eUh1CRMpc7BEg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042