UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tzHYs8GJ6tYYsF/F4h0cCs5ZMNLL1dFX3Sa2ugIcj8I=' 
WHERE 
  key_id = 'fe837f74d0c8aaf0ecb9a511437b20b095d28ec5330b740331238010a61d6c02' 
  AND (
    token = 'tzHYs8GJ6tYYsF/F4h0cCs5ZMNLL1dFX3Sa2ugIcj8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023