UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gv4a3l8bkLbdo5BIAR1DoiHEMiMzaOBW99uo+tGMENg=' 
WHERE 
  key_id = '0babbc5c633949912b2151a3cea4626fb8ef5caf9f06e8775957a59020aebf97' 
  AND (
    token = 'gv4a3l8bkLbdo5BIAR1DoiHEMiMzaOBW99uo+tGMENg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050