UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4M3bSxQFqyM1geGPmhWh1g2fRe0ZNmm4FxGXZiUehuU=' 
WHERE 
  key_id = '342160b29b823ccda2ee9baa537c273fd2435f7c37e9681510b118e0eb0d871d' 
  AND (
    token = '4M3bSxQFqyM1geGPmhWh1g2fRe0ZNmm4FxGXZiUehuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038