UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qSpuR6h9JzKUYj7dBCcs8b4si/N2CYWr0DLCcpuA5WI=' 
WHERE 
  key_id = '1b91415eeecaf2cf6598134d07db0cc738239b9baf5fdabd1d096d1c50493f95' 
  AND (
    token = 'qSpuR6h9JzKUYj7dBCcs8b4si/N2CYWr0DLCcpuA5WI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035