UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E43FEvvpRsQbD3aaHxgzXu39fHf0+MppGI6MCEgxInY=' 
WHERE 
  key_id = '5996a030ddfcd3b9c5ed96b7d68ec4c8374b1e184519452a239acd166170f182' 
  AND (
    token = 'E43FEvvpRsQbD3aaHxgzXu39fHf0+MppGI6MCEgxInY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035