UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gp1q+JtOR97rZNihOaScKBx0P+Uo2D3aZnE0bwaFVPw=' 
WHERE 
  key_id = '9adb2b70e265a582e5bff000211eadb7116c018ce85b7256b77657a5dd9ad83e' 
  AND (
    token = 'Gp1q+JtOR97rZNihOaScKBx0P+Uo2D3aZnE0bwaFVPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073