UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xKCs7GbRb0bHA0WMHU5wuiy948sVqj6IY22yLYCxjGg=' 
WHERE 
  key_id = '691dcd684aa45f8930f92a4bc4c3a5e30e506a587cd1891d9fb777ba52629d16' 
  AND (
    token = 'xKCs7GbRb0bHA0WMHU5wuiy948sVqj6IY22yLYCxjGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052