UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BTVPpCJCIojDSgMiJrKx/ip8RgNCAI26iYI6+nmRqgQ=' 
WHERE 
  key_id = '59ae48bf4959b1d365129dee0f6f864daf5f096072267e87c01d488699e32343' 
  AND (
    token = 'BTVPpCJCIojDSgMiJrKx/ip8RgNCAI26iYI6+nmRqgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037