UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vMHRBLQRGnU6AyleDh4ns7gvGcDggoZVJHKqMF1cM5Y=' 
WHERE 
  key_id = 'd5538ea7fef51fff2a7e14b8a3de1642ad1184ce9a24d99919ea5dfe531f55c7' 
  AND (
    token = 'vMHRBLQRGnU6AyleDh4ns7gvGcDggoZVJHKqMF1cM5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026